<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <%@include file="/common/common.jspf" %>

    <style type="text/css">
        .col-sm-3 {
            width: 15%;
            float: left;
        }

        .col-sm-9 {
            width: 85%;
            float: left;
        }
    </style>
</head>
<body>
<div class="l_err" style="width: 100%; margin-top: 2px;"></div>
<form id="form" name="form" class="form-horizontal" method="post" action="${ctx}/dsg/type/editEntity.shtml">
    <input type="hidden" class="form-control" value="${dsgtype.id}" name="dsgTypeFormMap.id" id="id">
    <section class="panel panel-default">
            <div class="panel-body">
                <div class="form-group">
                    <div class="col-sm-3">
                        <label class="control-label">商品类型</label>
                    </div>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" placeholder="请输入商品类型" name="dsgTypeFormMap.name" value="${dsgtype.name}"  style="width: 30%;">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-3">
                        <label class="control-label">类型编号</label>
                    </div>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" placeholder="类型编号" name="dsgTypeFormMap.code"  value="${dsgtype.code}" style="width: 30%;" readonly>
                    </div>
                </div>
                <div class="line line-dashed line-lg pull-in"></div>
                <div class="form-group">
                    <div class="col-sm-3">
                        <label class="control-label">状态</label>
                    </div>
                    <div class="col-sm-9">
                        <select name="dsgTypeFormMap.status" class="form-control m-b" tabindex="-1"
                                style="width: 30%; display: inline-block; margin: 0;float: left;" id="status">
                            <option value="">请选择</option>
                            <option value="1" <c:if test="${dsgtype.status==1}">selected="selected"</c:if>>正常
                            </option>
                            <option value="2" <c:if test="${dsgtype.status==2}">selected="selected"</c:if>>
                                失效
                            </option>
                        </select>
                    </div>
                </div>
            </div>
        <footer class="panel-footer text-right bg-light lter">
            <button type="submit" class="btn btn-success btn-s-xs">保存</button>
        </footer>
    </section>
</form>
<script type="application/javascript">
    $(function () {
        $("form").validate({
            submitHandler: function (form) { // 必须写在验证前面，否则无法ajax提交
                ly.ajaxSubmit(form, { // 验证新增是否成功
                    type: "post",
                    dataType: "json",
                    success: function (data) {
                        if (data == "success") {
                            layer.confirm('更新成功!是否关闭窗口?', function (index) {
                                parent.grid.loadData();
                                parent.layer.close(parent.pageii);
                                return false;
                            });
                        } else {
                            layer.alert('添加失败！', 3);
                        }
                    }
                });
            },
            errorPlacement: function (error, element) {//自定义提示错误位置
                $(".l_err").css('display', 'block');
                //element.css('border','3px solid #FFCCCC');
                $(".l_err").html(error.html());
            },
            success: function (label) {//验证通过后
                $(".l_err").css('display', 'none');
            }
        });

    });
</script>
</body>
</html>
